package guowenlong.golf.ui.friendlymatch;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.OnClick;
import guowenlong.golf.R;
import me.wenlong.mixutils.mvp.BaseActivity;

/**
 * des   : 描述
 * author: Administrator
 * email : guowenlong20000@gmail.com
 * time  : 2017年05月03日 上午 1:30.
 */

public class FriendlySettingActivity extends BaseActivity {

  @BindView(R.id.tv_back)
  TextView tvBack;
  @BindView(R.id.btn_friendly_save)
  Button btnFriendlySave;
  @BindView(R.id.rb_friendly_setting_1)
  RadioButton rbFriendlySetting1;
  @BindView(R.id.rb_friendly_setting_2)
  RadioButton rbFriendlySetting2;
  @BindView(R.id.rb_friendly_setting_3)
  RadioButton rbFriendlySetting3;

  @Override
  protected int getContentView(Bundle savedInstanceState) {
    return R.layout.activity_friendly_setting;
  }

  @Override
  protected void initView(Bundle savedInstanceState) {

  }

  @Override
  protected void initData() {

  }

  @OnClick({R.id.tv_back, R.id.btn_friendly_save, R.id.rb_friendly_setting_1, R.id.rb_friendly_setting_2,
      R.id.rb_friendly_setting_3})
  public void onViewClicked(View view) {
    switch (view.getId()) {
      case R.id.tv_back:
        finish();
        break;
      case R.id.btn_friendly_save:
        String str = "";
        if (rbFriendlySetting1.isChecked()){
          str = rbFriendlySetting1.getText().toString();
        }else if (rbFriendlySetting2.isChecked()){
          str = rbFriendlySetting2.getText().toString();
        }else if (rbFriendlySetting3.isChecked()){
          str = rbFriendlySetting3.getText().toString();
        }
        Intent intent = new Intent(this,FriendlyMatchActivity.class);
        intent.putExtra("action",str);
        setResult(RESULT_OK,intent);
        finish();
        break;
    }
  }
}
